package simulacao.modelo.pistas;

import javafx.scene.paint.Color;
import javafx.scene.shape.SVGPath;
import javafx.animation.transition.AnimationPath;
import javafx.scene.Node;
import javafx.scene.Group;

public class PistaCircuito extends Pista {

    def faixaExterna = SVGPath {
        content : "M 680.84375,80.6875 C 602.29108,79.731916 495.56242,94.257817 349.21875,137.40625 C 346.45182,138.22205 343.67632,139.00849 340.78125,139.875 C 340.49825,139.96342 340.21695,140.05719 339.9375,140.15625 C 339.81339,140.19865 334.8628,141.69128 329.65625,144.25 C 306.03551,155.85825 253.75279,188.30743 227.8125,248.0625 C 215.41674,276.61688 226.08801,305.49532 240.65625,336.71875 C 255.22449,367.94218 277.23633,401.2649 302.59375,431.09375 C 327.95117,460.9226 356.31231,487.1926 385.8125,503.34375 C 400.56259,511.41933 415.77227,517.10562 431.875,518.15625 C 447.97773,519.20688 465.32431,514.62599 478.75,503.5 C 490.61071,493.67093 498.13028,479.97308 500.53125,466.71875 C 502.93222,453.46442 501.21977,441.13478 498.65625,429.65625 C 493.52921,406.69919 484.73382,385.4954 482.125,367.625 C 479.51618,349.7546 480.51359,338.00288 494.84375,323.40625 C 509.17391,308.80962 535.1829,286.14575 585.91561,280.76333 C 589.53515,280.37931 594.69434,279.02476 600.5509,281.59267 C 600.85695,281.72686 609.73812,286.22811 610.77665,290.71031 C 616.16844,313.98091 615.26016,310.63213 616.5,334.5 C 618.97968,382.23573 615.41745,448.0493 622.375,506.09375 C 626.11452,537.29115 637.6854,561.71532 659.78125,572 C 681.8771,582.28468 703.90907,576.44425 724.6875,569.0625 C 766.24436,554.299 812.3666,527.26064 853.625,521.65625 C 871.91358,519.17199 887.77093,508.57977 897.90625,495 C 908.04157,481.42023 913.70439,465.36252 917.375,448.03125 C 924.71622,413.36871 923.89514,372.51605 920.3125,332.375 C 913.14723,252.0929 893.75,174.71875 893.75,174.71875 C 893.60446,174.15021 893.43767,173.58731 893.25,173.03125 C 893.25,173.03125 890.15114,164.41203 883.78125,155.3125 C 877.41136,146.21297 867.12477,134.78278 851.40625,123.78125 C 819.96922,101.77818 767.25263,81.738655 680.84375,80.6875 z"
        strokeWidth : larguraFaixaDeRodagem
        stroke : corAsfalto
        fill : Color {opacity : 0}
        translateX: deslocamentoX
        translateY: deslocamentoY
    };


    def faixaInterna = SVGPath {
        content : "M 683.93793,117.70027 C 609.16131,116.78518 503.16333,130.82707 355.10301,174.74271 C 352.18029,175.60962 349.39257,176.40894 346.58095,177.2555 C 343.85555,178.19226 344.36934,177.97315 342.44834,178.92285 C 326.35427,186.87946 279.38634,217.7203 259.88939,262.90136 C 258.8906,265.21588 257.78869,287.54831 270.49279,314.93911 C 283.19689,342.3299 301.91018,372.93853 325.52768,400.88509 C 349.14515,428.83164 376.59977,457.00018 398.82408,469.23882 C 409.93624,475.35815 421.85835,481.95068 428.75301,482.40276 C 435.64767,482.85484 444.21594,483.84147 448.55215,480.22652 C 452.97039,476.54318 456.20678,475.14386 463.0379,461.92495 C 467.26886,453.73759 465.15541,440.47815 458.13817,417.66109 C 446.90345,381.13058 444.7104,376.31571 445.52012,346.42272 C 445.92106,331.7959 462.18828,299.80629 475.01544,290.24309 C 504.34607,268.37584 531.37762,248.95866 578.89158,244.24292 C 595.21572,242.62276 611.92707,244.85994 622.68923,251.36502 C 633.45139,257.87011 642.53543,271.48108 646.54431,281.83791 C 654.53274,302.47579 654.56375,353.64929 654.36598,380.69005 C 653.97613,433.99382 650.59118,448.57786 658.43524,502.18694 C 662.02733,526.89842 671.55266,535.74995 676.16975,537.85364 C 685.53139,542.1191 699.00769,539.3054 716.34509,533.1099 C 751.01985,520.71893 799.85544,490.28198 856.7607,482.50594 C 863.01984,481.65064 866.22431,477.87703 870.65283,471.90823 C 875.08136,465.9394 879.46647,455.52086 882.35024,441.82532 C 888.11777,414.43426 888.02807,375.02225 884.54496,335.74847 C 877.73694,258.98466 859.42134,183.73621 858.58186,180.30842 C 858.42992,179.86754 857.94153,178.78183 855.19639,174.83666 C 851.61327,169.68718 845.08963,162.03914 833.48263,153.86551 C 810.26862,137.51827 766.19281,118.70689 683.93793,117.70027 z"
        strokeWidth : larguraFaixaDeRodagem
        stroke : corAsfalto
        fill : Color {opacity : 0}
        translateX: deslocamentoX
        translateY: deslocamentoY
    };

    def linhaCentral = SVGPath {
        content : "M 343.25456,159.26569 C 346.12415,158.40677 348.91847,157.6108 351.75192,156.75451 C 821.57756,14.770233 876.59445,177.62914 876.59445,177.62914 C 876.59445,177.62914 953.86269,486.70561 855.73051,501.63872 C 787.30484,512.05129 719.53163,564.10793 678.16222,558.1625 C 659.42386,555.46951 646.11828,539.46892 640.59167,504.77214 C 626.75718,417.91742 645.95606,320.05343 624.87517,279.5255 C 619.76083,269.6932 609.70654,261.15065 589.2382,262.29576 C 539.59698,265.07295 511.78602,285.06425 492.62969,300.10007 C 454.52195,330.01089 461.11914,367.12755 471.43539,398.0087 C 485.10101,438.91602 493.12342,462.3959 466.97338,489.59972 C 400.15427,559.11148 216.04635,319.68972 243.22497,256.12632 C 265.69684,203.57073 315.72117,172.04875 335.61227,162.273 C 339.16481,160.52707 341.76538,159.77451 343.25456,159.26569 z"
        stroke : corLinhaCentral
        strokeWidth : larguraLinhaCentral
        strokeDashArray : [ 20, 15 ]
        fill : Color {opacity : 0};
        translateX: deslocamentoX
        translateY: deslocamentoY
    }

    def backGroudLinhaCentral = SVGPath {
        content : linhaCentral.content
        stroke : corAsfalto
        strokeWidth : 20
        fill : Color {opacity : 0};
        translateX: deslocamentoX
        translateY: deslocamentoY
    }


    init {

        QUANTIDADE_DE_FAIXAS = 2;
        
        faixasDeRodagemAnimadas = [
            AnimationPath.createFromPath(faixaExterna),
            AnimationPath.createFromPath(faixaInterna)
        ];

    }


    //mzamith@ic.uff.br

    public override function create(): Node{
        return Group {
                    content: [
                        backGroudLinhaCentral,
                        faixaExterna,
                        faixaInterna,
                        linhaCentral
                    ]
                }
        }

}
